home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip: Internet
/
Chip Internet.iso
/
viewer
/
gsnt
/
bench.ps
< prev
next >
Wrap
Text File
|
1993-05-12
|
2KB
|
78 lines
% Copyright (C) 1993 Aladdin Enterprises. All rights reserved.
%
% This file is part of Ghostscript.
%
% Ghostscript is distributed in the hope that it will be useful, but
% WITHOUT ANY WARRANTY. No author or distributor accepts responsibility
% to anyone for the consequences of using it or for whether it serves any
% particular purpose or works at all, unless he says so in writing. Refer
% to the Ghostscript General Public License for full details.
%
% Everyone is granted permission to copy, modify and redistribute
% Ghostscript, but only under the conditions described in the Ghostscript
% General Public License. A copy of this license is supposed to have been
% given to you along with Ghostscript so you can know your rights and
% responsibilities. It should be in a file named COPYING. Among other
% things, the copyright notice and this notice must be preserved on all
% copies.
% bench.ps
% This file is a "wrapper" for benchmarking.
% It writes timing results on a file called:
/BOF where { pop } {
/BOF (bench.out) def
} ifelse
% Make sure all execution occurs under a `save'.
save pop
% Set the output device to an image device.
/Resolution where { pop } { /Resolution 100 def } ifelse
[ Resolution 72.0 div 0 0 Resolution -72.0 div 0 792 ]
Resolution 8.5 mul cvi
Resolution 11.0 mul cvi
<00 ff>
makeimagedevice
setdevice
% Redefine 'run' so that it collects timing information.
/.orig.run /run load def
/.run.finish % <file> <time> .run.finish <file>
{ usertime exch sub
1 index =string cvs .bench.file exch writestring
.bench.file (: run time = ) writestring
=string cvs .bench.file exch writestring
.bench.file ( ms\n) writestring
.bench.file flushfile
} bind def
/run % <string> run -
{ % We construct a bound procedure here so that
% we can invoke run recursively.
cvlit
2
{ /.orig.run load
save countdictstack 3 index usertime /.run.finish cvx
7 array astore cvx exec
exch countdictstack exch sub { end } repeat
exch restore
}
repeat
% Don't do the save & restore the last time.
/.orig.run load
1 index usertime /.run.finish cvx
5 array astore cvx exec pop
} bind odef
% Force a quit after processing files.
/.bench.file BOF (w) file def
/executive { .bench.file closefile quit } def
% Make sure we don't incur any pauses.
/NOPAUSE true def